#@layout()

#define main()
<div class="jfa-header-box" id="jfa-header-box">
	<div class="jfa-crumbs" id="jfa-crumbs">
		初始电泳框位置信息
	</div>
	#include("/_view/common/_header_right.html")
</div>
<div class="jfa-content-box" id="jfa-content-box">
	<div class="jfa-content" id="jfa-content">

		<div id="toolbar" class="btn-group">
	        <a class="btn btn-primary btn-sm" href="#(ctx)/admin/initRackPosition/add">
				<i class="fa fa-plus"></i>
				添加电泳框位置
			</a>
			
	    </div>
		<table id="rack">
			
		</table>
	</div>
</div>
<script type="text/javascript">
 	var datagridHeight=$("#jfa-content").height();
 	$('#rack').bootstrapTable({
        url: '#(ctx)/admin/initRackPosition/list',         
        method: 'get',
        toolbar: '#toolbar',
        striped: true,
        cache: false,
        pagination: true,
        sortable: false,                    
        sortOrder: "asc",  
        queryParams: function (params) {
	            var data = { 
	                    pageSize: params.limit,
	                    offset: params.offset
	            };
	            return data;
        },
        sidePagination: "server",
        pageNumber:1,
        toolbarAlign:"right",
        pageSize:210,         
        pageList: [210,420],
        search: false,
        strictSearch: true,
        showColumns: false,
        showRefresh: false,             
        minimumCountColumns: 2,
        clickToSelect: true,               
       	height: datagridHeight,
        uniqueId: "id",
        showToggle:false,
        cardView: false,
        detailView: false,
        columns: [
            {
                field: 'sort',  title: '序号'
            }, {
                field: 'position',  title: '坐标位置'
            },{
            	field: 'location',  title: '工艺位置'
            }, {
                title: '操作',formatter:operaterFormatter
            }
        ]
    });


function operaterFormatter(value, row, index){
	return "<a href='#(ctx)/admin/initRackPosition/edit?id="+row.id+"'>"+
	"<i class='fa fa-pencil' title='修改'></i>"+
	" </a> &nbsp"+
	"<a  href='#' onclick='deleteRack(\""+row.id+"\")'>"+
	"	<i class='fa fa-trash' title='删除'></i>"+
	"</a>"
}



function searchRack(){
	$('#rack').bootstrapTable("refresh",{silent: true});
    layer.msg('操作成功');
}

function deleteRack(id){
	layer.confirm("确认删除该记录？", {
		icon: 0
		, title:'' 
		, shade: 0.4
		, offset: "139px"
	}, function(index) { 
		$.ajax({
			url:"#(ctx)/admin/initRackPosition/delete",
			data:{"id":id},
			dataType:"json",
			success:function(ret){
				$('#rack').bootstrapTable("refresh",{silent: true});
			    layer.msg(ret.msg);
			    layer.close(index);   
			},
			error:function(){
				layer.close(index);   
			}
		});                           
		                       
	});
}

</script>
#end
